<template>
  <div class="organizing-unit-wrapper">
    <div class="title-wrapper">
      <span class="title">举办单位</span>
      <!-- <div class="disFlxAC">
                  <span class="more">查看全部 </span>
                  <a-icon type="right" style="font-size: 12px;line-height: 16px;" />
              </div> -->

    </div>
    <div class="organizing-unit-container">
      <div v-for="(item, index) in organizingUnitList.slice(0, 3)" :key="index" class="organizing-unit">
        <img :src="item.logo" style="width:40px;height: 40px;border-radius:40px" />
        <div class="unit-box">
          <span class="orgName ov-1">{{ item.orgName }}</span>
          <div v-if="item.tagName" class="unit-type" :style="{
            backgroundColor: getUnitType(item.activityType).background,
            color: getUnitType(item.activityType).color,
          }">
            <span>{{ item.tagName }}</span>
          </div>
        </div>
      </div>
    </div>
    <!-- <div v-if="isShowMore" class="more">
              <span>展开更多</span>
              <a-icon type="down" style="font-size: 12px;line-height: 16px; " />
          </div> -->
  </div>
</template>

<script>
import { activityTypeEnum } from "@/enums/activity";
export default {

  props: {
    organizingUnitList: {
      type: Array,
      default: function () {
        return [];
      },
    },
  },
  data() {
    return {
      // Data properties if any
    };
  },
  computed: {
    isShowMore() {
      // return this.organizingUnitList.length > 3;
      return false
    },
  },
  methods: {
    handleMoreClick() {
      this.$router.push({
        name: 'organizingUnitList',
        params: {
          organizingUnitList: this.organizingUnitList,
        },
      });
    },
    getUnitType(activityType) {
      return {
        [activityTypeEnum.oneself]: {
          background: '#2878FF',
          color: '#FFF',
        },
        [activityTypeEnum.other_join]: {
          background: '#D0F7FF',
          color: '#2878FF',
        },
      }[activityType] || {};
    },
  },
};
</script>

<style lang="less" scoped>
.organizing-unit-wrapper {
  padding: 16px;
  border-radius: 8px;
  background: #FFF;
  /* 默认卡片投影 */
  box-shadow: 0px 2px 12px 0px rgba(150, 151, 153, 0.16);

  .title-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;

    .title {
      color: #333;
      text-align: center;
      font-feature-settings: 'clig' off, 'liga' off;
      font-family: "PingFang SC";
      font-size: 16px;
      font-style: normal;
      font-weight: 700;
      line-height: 24px;
    }


  }

  .organizing-unit-container {
    display: flex;
    flex-direction: column;
    gap: 16px;

    .organizing-unit {
      display: flex;
      align-items: center;
      gap: 8px;

      .unit-box {
        display: flex;
        flex-direction: column;
        justify-content: left;
        gap: 8rpx;

        .orgName {
          font-size: 14px;
          font-weight: 700;
          line-height: 20px;
        }

        .unit-type {
          padding: 2px 4px;
          font-size: 8px;
          line-height: 10px;
          border-radius: 2px;
          width: fit-content;
        }
      }
    }
  }

  .more {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    color: #969799;
    font-size: 12px;
    line-height: 16px;
  }

}
</style>